//
//  CollectTableViewCell.m
//  Cooking
//
//  Created by ZhiPeng.Y on 15/9/9.
//  Copyright (c) 2015年 ZP.Y. All rights reserved.
//

#import "CollectTableViewCell.h"
#import "AppMacro.h"
#import "RecommendModel.h"
#import "UIImageView+WebCache.h"

@interface CollectTableViewCell ()

@property (retain, nonatomic) UIImageView *foodImageView;
@property (retain, nonatomic) UILabel     *foodLabel;

@end

@implementation CollectTableViewCell

- (void)dealloc {
    [_foodImageView release];
    [_foodLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    
    self.foodImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, WIDTH / 2, HEIGHT / 6)];
//    _foodImageView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:_foodImageView];
    [_foodImageView release];

    self.foodLabel = [[UILabel alloc] initWithFrame:CGRectMake(_foodImageView.frame.origin.x + _foodImageView.frame.size.width + 10, 10, WIDTH / 2 - 30, 20)];
    _foodLabel.font = [UIFont systemFontOfSize:18];
//    _foodLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_foodLabel];
    [_foodLabel release];
}

- (void)sendValueWithModel:(RecommendModel *)recommendModel {
    [_foodImageView sd_setImageWithURL:[NSURL URLWithString:recommendModel.imagePathThumbnails]];
    _foodLabel.text = recommendModel.name;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
